<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ page import="com.pzhu.pojo.Book" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSP 'showbooks.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

</head>

<body>
<br/><br/>
<h3>书籍列表</h3>
<a href="view/jsp/addbook.jsp">新增书目</a>
<a href="view/jsp/selectBook.jsp">查询书目</a>
<a href="view/jsp/addBooks.jsp">批量增加</a>
<a href="view/jsp/deletebook.jsp">批量删除书目</a>
<a href="view/jsp/updateBook.jsp">修改书目</a>

<table border="1px">
    <tr>
        <th>编号</th>
        <th>书名</th>
        <th>价格（元）</th>
        <th>作者</th>
        <th>出版社</th>
        <th>删除</th>
    </tr>
    <%
        List<Book> list = (List<Book>) request.getAttribute("list");
        for (int i = 0; i < list.size(); i++) {
    %>

    <tr>
        <td><%=list.get(i).getId()%>
        </td>
        <td><%=list.get(i).getName()%>
        </td>
        <td><%=list.get(i).getPrice()%>
        </td>
        <td><%=list.get(i).getAuthor()%>
        </td>
        <td><%=list.get(i).getPublisher()%>
        </td>
        <td>
            <form action="delete-book"><input type="hidden" name="id" value="<%=list.get(i).getId()%>">
                <input type="submit" value="删除"></form>
        </td>
    </tr>
    <%
        }
    %>
</table>
<br/><br/><br/><br/>

</body>

</html>
<script type="text/javascript">
</script>
